package com.demo.jpa.service;

import com.demo.jpa.dao.repository.UserRepository;
import lombok.extern.log4j.Log4j2;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import javax.transaction.Transactional;

/**
 * @Author:LiaoYouLe
 * @Date: Created in 2018/7/27
 * @Description query->namequery-prox
 * @Modifyied By:
 */
@Log4j2
public class BeforeDefine extends TestCase {
    @Autowired
    private UserRepository userRepository;

    @Test
    @Transactional
    public void findAllByNameQuery() {
        userRepository
                .findByPassword()
                .forEach(log::info);
    }


    @Test
    @Transactional
    public void findAllByNativeNameQuery() {
        userRepository
                .findAllByNativeQuery()
                .forEach(log::info);
    }
}
